using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

public partial class _controls_Common_CountryPicker : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        GenerateStartUpScript();
    }

    private void GenerateStartUpScript()
    {
        StringBuilder bld = new StringBuilder();
        bld.AppendFormat("document.getElementById('{0}').selectedCountryID = 0;", ClientID);
        Page.ClientScript.RegisterStartupScript(GetType(), "INIT", bld.ToString(),true);
    }

    public int SelectedCountry
    {
        get
        {
            return Convert.ToInt32(ddlCountry.SelectedValue);
        }
    }

    protected override void Render(HtmlTextWriter writer)
    {
        writer.Write(String.Format("<div id='{0}'>", ClientID));
        writer.Indent++;
        base.Render(writer);
        writer.Indent--;
        writer.Write("</div>");
    }
}
